package com.neo.tiny.bpm.controller.task;

import com.neo.tiny.bpm.service.task.BpmActivityService;
import com.neo.tiny.bpm.vo.activity.BpmActivityRespVO;
import com.neo.tiny.common.common.ResResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description: 管理后台 - 流程活动实例
 * @Author: yqz
 * @CreateDate: 2022/10/14 22:42
 */
@Api(tags = "管理后台 - 流程活动实例")
@RestController
@AllArgsConstructor
@RequestMapping("/bpm/activity")
public class BpmActivityController {

    private final BpmActivityService activityService;


    @GetMapping("/list")
    @ApiOperation(value = "生成指定流程实例的高亮流程图",
            notes = "只高亮进行中的任务。不过要注意，该接口暂时没用，通过前端的 ProcessViewer.vue 界面的 highlightDiagram 方法生成")
    @ApiImplicitParam(name = "processInstanceId", value = "流程实例的编号", required = true, dataTypeClass = String.class)
    public ResResult<List<BpmActivityRespVO>> getActivityList(
            @RequestParam("processInstanceId") String processInstanceId) {
        return ResResult.success(activityService.getActivityListByProcessInstanceId(processInstanceId));
    }
}
